﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using SharePoint2007Migration.Costants;
using System.Reflection;
using SharePoint2007Migration.Domain;

namespace SharePoint2007Migration
{
    public class MissingFeatureIssue : BaseIssue
    {
        Guid _featureId;

        public MissingFeatureIssue(IBaseIssue issue):base(issue.Text)
        {
           //upcasting
        }

        public Guid FeatureId
        {
            get
            {
                if (_featureId == Guid.Empty)
                    _featureId = Get_featureId();
                return _featureId;
            }
        }

        private Guid Get_featureId()
        {
            string id = ExtractAndCleanupStringFromMessage(RegexCostants.REGEX_FEATURE_FEATUREID, "Id = [", "]");
            return new Guid(id);
        }


        protected override string Get_contentDbName()
        {
            return ExtractAndCleanupStringFromMessage(RegexCostants.REGEX_FEATURE_CONTENT_DB, "Database [", "] has reference");
        }
    }
}
